HAL SD peripheral control functions ¶
This section provides information about HAL SD peripheral control functions for STM32 HAL1 to HAL2 migration.
HAL SD card initialization ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd)
|
Removed; usage sequence changed, see below note for details. |
Note
In HAL1,
HAL_SD_InitCard()can be invoked by the application to reinitialize the card after a hot plug-off/plug-in event.HAL2 provides
HAL_SD_NotifyCardRemoval()to set default configurations upon card plug-off. Then, application code should invokeHAL_SD_NotifyCardInsertion()at card insertion.Refer to Hot plug-in / Hot plug-off use case for more details on hot plug handling in HAL2.
HAL SD wide bus configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode)
|
Removed; to configure the bus width, set the appropriate field in the
|
HAL SD speed mode configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_ConfigSpeedBusOperation(SD_HandleTypeDef *hsd,
uint32_t SpeedMode)
|
hal_status_t HAL_SD_SwitchSpeedMode(hal_sd_handle_t *hsd,
hal_sd_speed_mode_t speed_mode)
|
Note
In HAL1, the speed mode selection parameter had used values defined in the SDMMC core driver (
sdmmc_core.h).
In HAL2, use the provided enumeration
hal_sd_speed_mode_t
for speed modes.
HAL SD card erase ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_Erase(SD_HandleTypeDef *hsd,
uint32_t BlockStartAdd,
uint32_t BlockEndAdd)
|
hal_status_t HAL_SD_Erase(hal_sd_handle_t *hsd,
uint32_t start_block_addr,
uint32_t end_block_addr)
|
HAL SD operation abort ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_Abort(SD_HandleTypeDef *hsd)
HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd)
|
hal_status_t HAL_SD_Abort(hal_sd_handle_t *hsd)
hal_status_t HAL_SD_Abort_IT(hal_sd_handle_t *hsd)
|
HAL SD card status ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd,
HAL_SD_CardStatusTypeDef *pStatus)
|
hal_status_t HAL_SD_GetCardStatus(hal_sd_handle_t *hsd,
hal_sd_card_status_t *p_status)
|
HAL SD card CID ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_GetCardCID(const SD_HandleTypeDef *hsd,
HAL_SD_CardCIDTypeDef *pCID)
|
void HAL_SD_GetCardCID(const hal_sd_handle_t *hsd,
hal_sd_card_cid_t *p_cid)
|
HAL SD card CSD ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD)
|
Removed; HAL2 parses CSD register internally, the function and related structure are removed. |
HAL SD card information ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SD_GetCardInfo(const SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo)
|
void HAL_SD_GetCardInfo(const hal_sd_handle_t *hsd, hal_sd_card_info_t *p_card_info)
|